# Copyright (c) 2020 Presto Labs Pte. Ltd.
# Author: donggu

import os
from absl import app
from absl import flags

FLAGS = flags.FLAGS
flags.DEFINE_string('dates', None, 'dates')
flags.mark_flag_as_required('dates')


def get_full_paths(d):
  return [d + '/' + f for f in os.listdir(d)]


def main(argv):
  del argv  # Unused

  usd_paths = get_full_paths('../coin_deploy/lm_agg2/config_coin1_style/donggu')
  for path in usd_paths:
    for currency in ['BCHSV', 'BCHABC', 'BTC', 'ETH', 'ETC', 'EOS', 'LTC', 'XRP']:
      if currency.lower() in path:
        for expiry in ['QUARTER', 'THIS_WEEK', 'NEXT_WEEK']:
          target = f'{currency}-USD.{expiry}'
          print(
            f'pueue add -- ./pyrunner ./python/experimental/donggu/search/search_lm.py' \
            f' --target {target} --dates {FLAGS.dates} --is_inverse=true --lm_config {path}'
          )

  usdt_paths = get_full_paths('../coin_deploy/lm_agg2/config_coin1_style/lab/usdt')
  for path in usdt_paths:
    for currency in ['BCHSV', 'BCHABC', 'BTC', 'ETH', 'ETC', 'EOS', 'LTC', 'XRP']:
      if currency.lower() in path:
        for expiry in ['QUARTER', 'THIS_WEEK', 'NEXT_WEEK']:
          target = f'{currency}-USDT.{expiry}'
          print(
            f'pueue add -- ./pyrunner ./python/experimental/donggu/search/search_lm.py' \
            f' --target {target} --dates {FLAGS.dates} --is_inverse=false --lm_config {path}'
          )


if __name__ == '__main__':
  app.run(main)
